FROM node:18-bullseye-slim
RUN apt-get update && \
    apt-get install -y git docker.io python3 make gcc g++ curl jq
ARG NITRO_CONTRACTS_BRANCH=main
WORKDIR /workspace  
RUN git clone --no-checkout https://github.com/OffchainLabs/nitro-contracts.git ./
RUN git checkout ${NITRO_CONTRACTS_BRANCH}
RUN yarn install && yarn cache clean

# RUN curl -L https://foundry.paradigm.xyz | bash

COPY install.sh /tmp/install.sh
COPY foundryup.sh /tmp/foundryup.sh
RUN chmod +x /tmp/install.sh
RUN /tmp/install.sh

ENV PATH="${PATH}:/root/.foundry/bin"
RUN foundryup
RUN touch scripts/config.ts
RUN yarn build:all
ENTRYPOINT ["yarn"]
